<link rel="stylesheet" href="{{asset('css/app.css')}}">
<link rel="stylesheet" type="text/css" href="{{URL::asset('css/user/salesman.css')}}">
<style>
    form{
        position:relative;
    }
    .error{
        color:red;
    }
    #name-error{
        position:absolute;
        top:20px;
        /*left:30px;*/
    }
    #email-error{
        position:absolute;
        top:90px;
        /*left:30px;*/
    }
    #phone-error{
        position:absolute;
        top:165px;
        /*left:30px;*/
    }
</style>
    <div class="salesman">
        <h1>编辑业务员</h1>
        <form class="cmxform" id="commentForm" method="post" action="" >
            {{csrf_field()}}
            <div class="input_box" style="text-align: center">
                <p><label for="name">姓名：<input type="text" id="name" name="name" value="{{$sale->name}}"></label></p>
                <p><label for="email">邮箱：<input type="email" name="email" value="{{$sale->email}}"></label></p>
                <p><label for="phone">联系电话：<input type="phone" name="phone" value="{{$sale->phone}}"></label></p>
            </div>
            <div class="radio_box">
                <label for="type">权限：
                    <input type="radio" name="type" value="1" @if($sale->type == 1) checked @endif>主营业务员
                    <input type="radio" name="type" value="2" @if($sale->type == 2) checked @endif>副营业务员
                </label>
            </div>
            <p>
                <input type="submit" value="保存提交" class="submit submit_serva">
            </p>
        </form>
        @include('flash::message')
    </div>
<script type="text/javascript" src="{{asset('/common/js/jquery.min.js')}}"></script>
<script src="{{asset('/common/js/validation/jquery.validate.min.js')}}"></script>
<script src="{{asset('/common/js/validation/localization/messages_zh.min.js')}}"></script>
<script type="text/javascript" src="{{URL::asset('js/user/salesman.js')}}"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script>
    //表单验证
    $().ready(function() {
// 在键盘按下并释放及提交后验证提交表单
        $("#commentForm").validate({
            rules: {
                name: {
                    required: true,
                    minlength: 2
                },
                email: {
                    required: true,
                    email: true
                },
                phone: {
                    required:  true,
                    digits: true,
                    maxlength: 11,
                    minlength: 11

                }
            },
            messages: {
                name: {
                    required: "请输入姓名",
                    minlength: "姓名至少由两个字母组成"
                },
                email: {
                    required: "请输入电子邮箱",
                    email: "请输入有效的电子邮件地址",
                },
                phone: {

                    required:  "请输入手机号码长度为11位",
                    digits: "只能输入数字",
                    maxlength: "请输入正确的手机号码长度为11位",
                    minlength: "请输入正确的手机号码长度为11位",
                }

            }
            // rules: {
            //     name: {
            //         required: true,
            //         minlength: 2
            //     }
            // },
            // message: {
            //     name: {
            //         required: "请输入姓名",
            //         minlength: "长度至少两个字符"
            //     }
            // }
        })
    });
</script>


